import deck
import 14utils
import 14

numPlayers = 0
numDecks = ''
players = []
cardDeck = deck.Deck()

def main():
    try:      
        numPlayers = int(input("Number of Players (2-4): "))
        
        if not 14utils.restrictInput(numPlayers, 2, 4):
            raise ValueError
        
        elif numPlayers == 4:
            numDecks = input("Number of Decks to use (default 1, max 2): ")
            if numDecks == '':
                numDecks = 1
            else:
                numDecks = int(numDecks)
                
            if not 14utils.restrictInput(numDecks, 1, 2):
                raise ValueError
            elif numDecks == 2:
                cardDeck.generateDeck()
        
    except ValueError:
        print("Invalid Input")

    else:
        for i in range(numPlayers):
            player = 14.Player()
            cardDeck.dealTo(player.faceDownCards,3)
            cardDeck.dealTo(player.faceUpCards,3)
            cardDeck.dealTo(player.hand,5)
            players.append(player)

# Main Program
main()
